<div class="groups index">
	<h2><?php echo __('Grupos para evaluar'); ?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo $this->Paginator->sort('id'); ?></th>
			<th><?php echo $this->Paginator->sort('name'); ?></th>
			<th><?php echo $this->Paginator->sort('institution_id'); ?></th>
			<th> <?php echo __('alumnos') ?> </th>

			<th class="actions"><?php echo __('Acciones'); ?></th>
			<th><?php echo __(' '); ?></th>
			<th><?php echo __(' '); ?></th>
	</tr>	
	<?php foreach ($groups as $group): ?>
	<tr>
		<td><?php echo h($group['Group']['id']); ?>&nbsp;</td>
		<td><?php echo h($group['Group']['name']); ?>&nbsp;</td>
		<td>
			<?php echo $this->Html->link($group['Institution']['nombre'], array('controller' => 'institutions', 'action' => 'view', $group['Institution']['id'])); ?>
		</td>
		<!-- aqui se listaran los alumnos pertenecientes a la intitucion -->
		<td>
            <?php $lider=" ";?>
            <?php $groupuser=" ";?>
		     <?php foreach ($groupsUsers as $alumno): ?>
		     	<?php if ($alumno['GroupUser']['group_id']==$group['Group']['id']): ?>
		     		<?php echo h($alumno['User']['nombres']); ?>&nbsp;
		     		<?php $groupuser=$alumno['GroupUser']['id'];?>
		     		<?php if ($alumno['GroupUser']['lider']==1): ?>
		     		<?php $lider=$alumno['User']['id'] ;?>
		     		<?php endif; ?>
		     	     <p> </p>
		     	<?php endif; ?>
		     <?php endforeach; ?>
            
		</td>

		<?php if ($lider!=" "): ?>
		<td>
			<!-- le paso el lider del  grupo <?php echo $lider['nombres'] ; ?> -->
			<?php echo $this->Html->link(__('Ver avance'), array('action'=>'ver_avance',$lider)); ?>
		</td>
		<td>
			<?php echo $this->Form->create('Evaluation',array('action' => 'crear3','url' =>array($lider)));
				echo $this->Form->hidden('institution_id',array('label'=>'','value' => $group['Institution']['id']));
				echo $this->Form->hidden('preview_id');
				echo $this->Form->hidden('group_id',array('label'=>'','value' => $group['Group']['id']));
				echo $this->Form->hidden('tipo',array('label'=>'','value' => 'Video'));
				echo $this->Form->hidden('plantilla_id',array('label'=>'','value' => 4));			
			    $options = array('label' => 'Evaluar Video','div' => array('class' => 'glass-pill',));
    		echo $this->Form->end($options); ?>
    	</td>
    	<td>	
			<!-- evaluar informe -->
				<?php echo $this->Form->create('Evaluation',array('action' => 'crear3','url' =>array($lider)));
				echo $this->Form->hidden('institution_id',array('label'=>'','value' => $group['Institution']['id']));
				echo $this->Form->hidden('preview_id');
				echo $this->Form->hidden('group_id',array('label'=>'','value' => $group['Group']['id']));
				echo $this->Form->hidden('tipo',array('label'=>'','value' => 'Informe'));
				echo $this->Form->hidden('plantilla_id',array('label'=>'','value' => 3));
				$options = array('label' => 'Evaluar informe','div' => array('class' => 'glass-pill',));
    		echo $this->Form->end($options); ?>
    	</td>
    	<?php else: ?>
    		<td>No existen alumnos asociados ver avance</td>
    		<td>No existen alumnos asociados para evaluar</td>
    		<td>No existen alumnos asociados para evaluar</td>
    	<?php endif; ?>					
        										
    									
											
				

			<!-- aqui tienes que agregar las llamadas al metodo crear del controlador evaluations 
<!--			<?php echo $this->Html->link(__('Evaluar video'), array('action' => 'boton_evaluar', $group['Group']['id'],$group['Institution']['id'],'Video',$groupuser,$lider)); ?> -->
<!--			<?php echo $this->Html->link(__('Evaluar informe'), array('action' => 'boton_evaluar', $group['Group']['id'],$group['Institution']['id'],'Informe',$groupuser,$lider)); ?> -->
		
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
	));
	?>	</p>
	<div class="paging">
	<?php
		echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>
</div>
<div class="actions">
	<h3><?php echo __('Actions'); ?></h3>
	<ul>
		<?php if($this->Session->read('Auth.User.role_id')=='1'): ?> 
			<li><?php echo $this->Html->link(__('Plantillas'), array('controller' => 'plantillas', 'action' => 'index')); ?> </li>		
			<li><?php echo $this->Html->link(__('Listar Evaluaciones'), array('controller' => 'evaluations', 'action' => 'index')); ?> </li>
		<?php endif; ?>
		<?php if($this->Session->read('Auth.User.role_id')=='6'): ?>
			<li><?php echo $this->Html->link(__('Mis Evaluaciones'), array('controller' => 'evaluations', 'action' => 'index')); ?> </li>
		<?php endif; ?>
	</ul>
</div>
